<?php
session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include "ewcfg7.php" ?>
<?php include "adodb" . EW_PATH_DELIMITER . "adodb.inc.php" ?>
<?php include "phpfn7.php" ?>
<?php include "ReporteCuotasinfo.php" ?>
<?php include "usuariosinfo.php" ?>
<?php include "userfn7.php" ?>
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // Always modified
header("Cache-Control: private, no-store, no-cache, must-revalidate"); // HTTP/1.1 
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
?>
<?php

// Create page object
$ReporteCuotas_list = new cReporteCuotas_list();
$Page =& $ReporteCuotas_list;

// Page init
$ReporteCuotas_list->Page_Init();

// Page main
$ReporteCuotas_list->Page_Main();
?>
<?php include "header.php" ?>
<?php if ($ReporteCuotas->Export == "") { ?>
<script type="text/javascript">
<!--

// Create page object
var ReporteCuotas_list = new ew_Page("ReporteCuotas_list");

// page properties
ReporteCuotas_list.PageID = "list"; // page ID
ReporteCuotas_list.FormID = "fReporteCuotaslist"; // form ID
var EW_PAGE_ID = ReporteCuotas_list.PageID; // for backward compatibility

// extend page with validate function for search
ReporteCuotas_list.ValidateSearch = function(fobj) {
	ew_PostAutoSuggest(fobj);
	if (this.ValidateRequired) {
		var infix = "";
		elm = fobj.elements["x" + infix + "_Creditos"];
		if (elm && !ew_CheckInteger(elm.value))
			return ew_OnError(this, elm, "<?php echo ew_JsEncode2($ReporteCuotas->Creditos->FldErrMsg()) ?>");

		// Call Form Custom Validate event
		if (!this.Form_CustomValidate(fobj))
			return false;
	}
	for (var i=0; i<fobj.elements.length; i++) {
		var elem = fobj.elements[i];
		if (elem.name.substring(0,2) == "s_" || elem.name.substring(0,3) == "sv_")
			elem.value = "";
	}
	return true;
}

// extend page with Form_CustomValidate function
ReporteCuotas_list.Form_CustomValidate =  
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }
<?php if (EW_CLIENT_VALIDATE) { ?>
ReporteCuotas_list.ValidateRequired = true; // uses JavaScript validation
<?php } else { ?>
ReporteCuotas_list.ValidateRequired = false; // no JavaScript validation
<?php } ?>

//-->
</script>
<script type="text/javascript">
<!--
var ew_DHTMLEditors = [];

//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--

// Write your client script here, no need to add script tags.
// To include another .js script, use:
// ew_ClientScriptInclude("my_javascript.js"); 
//-->

</script>
<?php } ?>
<?php if ($ReporteCuotas->Export == "") { ?>
<?php } ?>
<?php
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$ReporteCuotas_list->lTotalRecs = $ReporteCuotas->SelectRecordCount();
	} else {
		if ($rs = $ReporteCuotas_list->LoadRecordset())
			$ReporteCuotas_list->lTotalRecs = $rs->RecordCount();
	}
	$ReporteCuotas_list->lStartRec = 1;
	if ($ReporteCuotas_list->lDisplayRecs <= 0 || ($ReporteCuotas->Export <> "" && $ReporteCuotas->ExportAll)) // Display all records
		$ReporteCuotas_list->lDisplayRecs = $ReporteCuotas_list->lTotalRecs;
	if (!($ReporteCuotas->Export <> "" && $ReporteCuotas->ExportAll))
		$ReporteCuotas_list->SetUpStartRec(); // Set up start record position
	if ($bSelectLimit)
		$rs = $ReporteCuotas_list->LoadRecordset($ReporteCuotas_list->lStartRec-1, $ReporteCuotas_list->lDisplayRecs);
?>
<p><span class="phpmaker" style="white-space: nowrap;"><?php echo $Language->Phrase("TblTypeVIEW") ?><?php echo $ReporteCuotas->TableCaption() ?>
<?php if ($ReporteCuotas->Export == "" && $ReporteCuotas->CurrentAction == "") { ?>
&nbsp;&nbsp;<a href="<?php echo $ReporteCuotas_list->ExportPrintUrl ?>"><?php echo $Language->Phrase("PrinterFriendly") ?></a>
&nbsp;&nbsp;<a href="<?php echo $ReporteCuotas_list->ExportExcelUrl ?>"><?php echo $Language->Phrase("ExportToExcel") ?></a>
&nbsp;&nbsp;<a href="<?php echo $ReporteCuotas_list->ExportCsvUrl ?>"><?php echo $Language->Phrase("ExportToCsv") ?></a>
<?php } ?>
</span></p>
<?php if ($Security->IsLoggedIn()) { ?>
<?php if ($ReporteCuotas->Export == "" && $ReporteCuotas->CurrentAction == "") { ?>
<a href="javascript:ew_ToggleSearchPanel(ReporteCuotas_list);" style="text-decoration: none;"><img id="ReporteCuotas_list_SearchImage" src="images/collapse.gif" alt="" width="9" height="9" border="0"></a><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("Search") ?></span><br>
<div id="ReporteCuotas_list_SearchPanel">
<form name="fReporteCuotaslistsrch" id="fReporteCuotaslistsrch" class="ewForm" action="<?php echo ew_CurrentPage() ?>" onsubmit="return ReporteCuotas_list.ValidateSearch(this);">
<input type="hidden" id="t" name="t" value="ReporteCuotas">
<?php
if ($gsSearchError == "")
	$ReporteCuotas_list->LoadAdvancedSearch(); // Load advanced search

// Render for search
$ReporteCuotas->RowType = EW_ROWTYPE_SEARCH;

// Render row
$ReporteCuotas_list->RenderRow();
?>
<table class="ewBasicSearch">
	<tr>
		<td><span class="phpmaker"><?php echo $ReporteCuotas->Creditos->FldCaption() ?></span></td>
		<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Creditos" id="z_Creditos" value="="></span></td>
		<td>			
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Creditos" id="x_Creditos" title="<?php echo $ReporteCuotas->Creditos->FldTitle() ?>" size="30" value="<?php echo $ReporteCuotas->Creditos->EditValue ?>"<?php echo $ReporteCuotas->Creditos->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr>
		<td><span class="phpmaker"><?php echo $ReporteCuotas->id->FldCaption() ?></span></td>
		<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_id" id="z_id" value="="></span></td>
		<td>			
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<select id="x_id" name="x_id" title="<?php echo $ReporteCuotas->id->FldTitle() ?>"<?php echo $ReporteCuotas->id->EditAttributes() ?>>
<?php
if (is_array($ReporteCuotas->id->EditValue)) {
	$arwrk = $ReporteCuotas->id->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($ReporteCuotas->id->AdvancedSearch->SearchValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
?>
</select>
<?php
$sSqlWrk = "SELECT [id], [Nombre], '' AS Disp2Fld FROM [sucursales]";
$sWhereWrk = "";
if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
$sSqlWrk = TEAencrypt($sSqlWrk, EW_RANDOM_KEY);
?>
<input type="hidden" name="s_x_id" id="s_x_id" value="<?php echo $sSqlWrk; ?>">
<input type="hidden" name="lft_x_id" id="lft_x_id" value="">
</span>
			</div>
		</td>
	</tr>
	<tr>
		<td><span class="phpmaker"><?php echo $ReporteCuotas->Nombre->FldCaption() ?></span></td>
		<td><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Nombre" id="z_Nombre" value="LIKE"></span></td>
		<td>			
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Nombre" id="x_Nombre" title="<?php echo $ReporteCuotas->Nombre->FldTitle() ?>" size="30" value="<?php echo $ReporteCuotas->Nombre->EditValue ?>"<?php echo $ReporteCuotas->Nombre->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr>
		<td><span class="phpmaker"><?php echo $ReporteCuotas->Apellido->FldCaption() ?></span></td>
		<td><span class="ewSearchOpr"><?php echo $Language->Phrase("LIKE") ?><input type="hidden" name="z_Apellido" id="z_Apellido" value="LIKE"></span></td>
		<td>			
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Apellido" id="x_Apellido" title="<?php echo $ReporteCuotas->Apellido->FldTitle() ?>" size="30" value="<?php echo $ReporteCuotas->Apellido->EditValue ?>"<?php echo $ReporteCuotas->Apellido->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr>
		<td><span class="phpmaker"><?php echo $ReporteCuotas->Dni->FldCaption() ?></span></td>
		<td><span class="ewSearchOpr"><?php echo $Language->Phrase("=") ?><input type="hidden" name="z_Dni" id="z_Dni" value="="></span></td>
		<td>			
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_Dni" id="x_Dni" title="<?php echo $ReporteCuotas->Dni->FldTitle() ?>" size="30" value="<?php echo $ReporteCuotas->Dni->EditValue ?>"<?php echo $ReporteCuotas->Dni->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
	<tr>
		<td><span class="phpmaker"><?php echo $ReporteCuotas->vencimiento->FldCaption() ?></span></td>
		<td><span class="ewSearchOpr"><?php echo $Language->Phrase(">=") ?><input type="hidden" name="z_vencimiento" id="z_vencimiento" value=">="></span></td>
		<td>			
			<div style="white-space: nowrap;">
				<span class="phpmaker" style="float: left;">
<input type="text" name="x_vencimiento" id="x_vencimiento" title="<?php echo $ReporteCuotas->vencimiento->FldTitle() ?>" size="30" maxlength="10" value="<?php echo $ReporteCuotas->vencimiento->EditValue ?>"<?php echo $ReporteCuotas->vencimiento->EditAttributes() ?>>
</span>
				<span class="ewSearchOpr" id="btw0_vencimiento" name="btw0_vencimiento"><label><input type="radio" name="v_vencimiento" id="v_vencimiento" value="AND"<?php if ($ReporteCuotas->vencimiento->AdvancedSearch->SearchCondition <> "OR") echo " checked=\"checked\"" ?>><?php echo $Language->Phrase("AND") ?></label>&nbsp;<label><input type="radio" name="v_vencimiento" id="v_vencimiento" value="OR"<?php if ($ReporteCuotas->vencimiento->AdvancedSearch->SearchCondition == "OR") echo " checked=\"checked\"" ?>><?php echo $Language->Phrase("OR") ?></label>&nbsp;</span>
				<span class="ewSearchOpr" id="btw0_vencimiento" name="btw0_vencimiento" ><?php echo $Language->Phrase("<=") ?><input type="hidden" name="w_vencimiento" id="w_vencimiento" value="<="></span>
				<span class="phpmaker" style="float: left;">
<input type="text" name="y_vencimiento" id="y_vencimiento" title="<?php echo $ReporteCuotas->vencimiento->FldTitle() ?>" size="30" maxlength="10" value="<?php echo $ReporteCuotas->vencimiento->EditValue2 ?>"<?php echo $ReporteCuotas->vencimiento->EditAttributes() ?>>
</span>
			</div>
		</td>
	</tr>
</table>
<table class="ewBasicSearch">
	<tr>
		<td><span class="phpmaker">
			<input type="text" name="<?php echo EW_TABLE_BASIC_SEARCH ?>" id="<?php echo EW_TABLE_BASIC_SEARCH ?>" size="20" value="<?php echo ew_HtmlEncode($ReporteCuotas->getSessionBasicSearchKeyword()) ?>">
			<input type="Submit" name="Submit" id="Submit" value="<?php echo ew_BtnCaption($Language->Phrase("QuickSearchBtn")) ?>">&nbsp;
			<a href="<?php echo $ReporteCuotas_list->PageUrl() ?>cmd=reset"><?php echo $Language->Phrase("ShowAll") ?></a>&nbsp;
		</span></td>
	</tr>
	<tr>
	<td><span class="phpmaker"><label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value=""<?php if ($ReporteCuotas->getSessionBasicSearchType() == "") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("ExactPhrase") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="AND"<?php if ($ReporteCuotas->getSessionBasicSearchType() == "AND") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AllWord") ?></label>&nbsp;&nbsp;<label><input type="radio" name="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" id="<?php echo EW_TABLE_BASIC_SEARCH_TYPE ?>" value="OR"<?php if ($ReporteCuotas->getSessionBasicSearchType() == "OR") { ?> checked="checked"<?php } ?>><?php echo $Language->Phrase("AnyWord") ?></label></span></td>
	</tr>
</table>
</form>
</div>
<?php } ?>
<?php } ?>
<?php
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
$ReporteCuotas_list->ShowMessage();
?>
<br>
<table cellspacing="0" class="ewGrid"><tr><td class="ewGridContent">
<form name="fReporteCuotaslist" id="fReporteCuotaslist" class="ewForm" action="" method="post">
<div id="gmp_ReporteCuotas" class="ewGridMiddlePanel">
<?php if ($ReporteCuotas_list->lTotalRecs > 0) { ?>
<table cellspacing="0" rowhighlightclass="ewTableHighlightRow" rowselectclass="ewTableSelectRow" roweditclass="ewTableEditRow" class="ewTable ewTableSeparate">
<?php echo $ReporteCuotas->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$ReporteCuotas_list->RenderListOptions();

// Render list options (header, left)
$ReporteCuotas_list->ListOptions->Render("header", "left");
?>
<?php if ($ReporteCuotas->Creditos->Visible) { // Creditos ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->Creditos) == "") { ?>
		<td><?php echo $ReporteCuotas->Creditos->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->Creditos) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->Creditos->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->Creditos->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->Creditos->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->Financiera->Visible) { // Financiera ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->Financiera) == "") { ?>
		<td><?php echo $ReporteCuotas->Financiera->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->Financiera) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->Financiera->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->Financiera->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->Financiera->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->id->Visible) { // id ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->id) == "") { ?>
		<td><?php echo $ReporteCuotas->id->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->id) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->id->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->id->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->id->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->Nombre->Visible) { // Nombre ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->Nombre) == "") { ?>
		<td><?php echo $ReporteCuotas->Nombre->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->Nombre) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->Nombre->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->Nombre->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->Nombre->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->Apellido->Visible) { // Apellido ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->Apellido) == "") { ?>
		<td><?php echo $ReporteCuotas->Apellido->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->Apellido) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->Apellido->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->Apellido->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->Apellido->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->Dni->Visible) { // Dni ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->Dni) == "") { ?>
		<td><?php echo $ReporteCuotas->Dni->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->Dni) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->Dni->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->Dni->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->Dni->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->cuota->Visible) { // cuota ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->cuota) == "") { ?>
		<td><?php echo $ReporteCuotas->cuota->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->cuota) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->cuota->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->cuota->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->cuota->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->vencimiento->Visible) { // vencimiento ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->vencimiento) == "") { ?>
		<td><?php echo $ReporteCuotas->vencimiento->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->vencimiento) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->vencimiento->FldCaption() ?><?php echo $Language->Phrase("SrchLegend") ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->vencimiento->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->vencimiento->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->capital->Visible) { // capital ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->capital) == "") { ?>
		<td><?php echo $ReporteCuotas->capital->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->capital) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->capital->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->capital->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->capital->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->intereses->Visible) { // intereses ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->intereses) == "") { ?>
		<td><?php echo $ReporteCuotas->intereses->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->intereses) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->intereses->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->intereses->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->intereses->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->total->Visible) { // total ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->total) == "") { ?>
		<td><?php echo $ReporteCuotas->total->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->total) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->total->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->total->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->total->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->saldo->Visible) { // saldo ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->saldo) == "") { ?>
		<td><?php echo $ReporteCuotas->saldo->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->saldo) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->saldo->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->saldo->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->saldo->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->punitorios->Visible) { // punitorios ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->punitorios) == "") { ?>
		<td><?php echo $ReporteCuotas->punitorios->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->punitorios) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->punitorios->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->punitorios->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->punitorios->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php if ($ReporteCuotas->estado->Visible) { // estado ?>
	<?php if ($ReporteCuotas->SortUrl($ReporteCuotas->estado) == "") { ?>
		<td><?php echo $ReporteCuotas->estado->FldCaption() ?></td>
	<?php } else { ?>
		<td><div class="ewPointer" onmousedown="ew_Sort(event,'<?php echo $ReporteCuotas->SortUrl($ReporteCuotas->estado) ?>',1);">
			<table cellspacing="0" class="ewTableHeaderBtn"><thead><tr><td><?php echo $ReporteCuotas->estado->FldCaption() ?></td><td style="width: 10px;"><?php if ($ReporteCuotas->estado->getSort() == "ASC") { ?><img src="images/sortup.gif" width="10" height="9" border="0"><?php } elseif ($ReporteCuotas->estado->getSort() == "DESC") { ?><img src="images/sortdown.gif" width="10" height="9" border="0"><?php } ?></td></tr></thead></table>
		</div></td>		
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$ReporteCuotas_list->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<?php
if ($ReporteCuotas->ExportAll && $ReporteCuotas->Export <> "") {
	$ReporteCuotas_list->lStopRec = $ReporteCuotas_list->lTotalRecs;
} else {
	$ReporteCuotas_list->lStopRec = $ReporteCuotas_list->lStartRec + $ReporteCuotas_list->lDisplayRecs - 1; // Set the last record to display
}
$ReporteCuotas_list->lRecCount = $ReporteCuotas_list->lStartRec - 1;
if ($rs && !$rs->EOF) {
	$rs->MoveFirst();
	if (!$bSelectLimit && $ReporteCuotas_list->lStartRec > 1)
		$rs->Move($ReporteCuotas_list->lStartRec - 1);
}

// Initialize aggregate
$ReporteCuotas->RowType = EW_ROWTYPE_AGGREGATEINIT;
$ReporteCuotas_list->RenderRow();
$ReporteCuotas_list->lRowCnt = 0;
while (($ReporteCuotas->CurrentAction == "gridadd" || !$rs->EOF) &&
	$ReporteCuotas_list->lRecCount < $ReporteCuotas_list->lStopRec) {
	$ReporteCuotas_list->lRecCount++;
	if (intval($ReporteCuotas_list->lRecCount) >= intval($ReporteCuotas_list->lStartRec)) {
		$ReporteCuotas_list->lRowCnt++;

	// Init row class and style
	$ReporteCuotas->CssClass = "";
	$ReporteCuotas->CssStyle = "";
	$ReporteCuotas->RowAttrs = array('onmouseover'=>'ew_MouseOver(event, this);', 'onmouseout'=>'ew_MouseOut(event, this);', 'onclick'=>'ew_Click(event, this);');
	if ($ReporteCuotas->CurrentAction == "gridadd") {
		$ReporteCuotas_list->LoadDefaultValues(); // Load default values
	} else {
		$ReporteCuotas_list->LoadRowValues($rs); // Load row values
	}
	$ReporteCuotas->RowType = EW_ROWTYPE_VIEW; // Render view

	// Render row
	$ReporteCuotas_list->RenderRow();

	// Render list options
	$ReporteCuotas_list->RenderListOptions();
?>
	<tr<?php echo $ReporteCuotas->RowAttributes() ?>>
<?php

// Render list options (body, left)
$ReporteCuotas_list->ListOptions->Render("body", "left");
?>
	<?php if ($ReporteCuotas->Creditos->Visible) { // Creditos ?>
		<td<?php echo $ReporteCuotas->Creditos->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->Creditos->ViewAttributes() ?>><?php echo $ReporteCuotas->Creditos->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->Financiera->Visible) { // Financiera ?>
		<td<?php echo $ReporteCuotas->Financiera->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->Financiera->ViewAttributes() ?>><?php echo $ReporteCuotas->Financiera->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->id->Visible) { // id ?>
		<td<?php echo $ReporteCuotas->id->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->id->ViewAttributes() ?>><?php echo $ReporteCuotas->id->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->Nombre->Visible) { // Nombre ?>
		<td<?php echo $ReporteCuotas->Nombre->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->Nombre->ViewAttributes() ?>><?php echo $ReporteCuotas->Nombre->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->Apellido->Visible) { // Apellido ?>
		<td<?php echo $ReporteCuotas->Apellido->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->Apellido->ViewAttributes() ?>><?php echo $ReporteCuotas->Apellido->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->Dni->Visible) { // Dni ?>
		<td<?php echo $ReporteCuotas->Dni->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->Dni->ViewAttributes() ?>><?php echo $ReporteCuotas->Dni->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->cuota->Visible) { // cuota ?>
		<td<?php echo $ReporteCuotas->cuota->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->cuota->ViewAttributes() ?>><?php echo $ReporteCuotas->cuota->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->vencimiento->Visible) { // vencimiento ?>
		<td<?php echo $ReporteCuotas->vencimiento->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->vencimiento->ViewAttributes() ?>><?php echo $ReporteCuotas->vencimiento->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->capital->Visible) { // capital ?>
		<td<?php echo $ReporteCuotas->capital->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->capital->ViewAttributes() ?>><?php echo $ReporteCuotas->capital->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->intereses->Visible) { // intereses ?>
		<td<?php echo $ReporteCuotas->intereses->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->intereses->ViewAttributes() ?>><?php echo $ReporteCuotas->intereses->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->total->Visible) { // total ?>
		<td<?php echo $ReporteCuotas->total->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->total->ViewAttributes() ?>><?php echo $ReporteCuotas->total->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->saldo->Visible) { // saldo ?>
		<td<?php echo $ReporteCuotas->saldo->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->saldo->ViewAttributes() ?>><?php echo $ReporteCuotas->saldo->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->punitorios->Visible) { // punitorios ?>
		<td<?php echo $ReporteCuotas->punitorios->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->punitorios->ViewAttributes() ?>><?php echo $ReporteCuotas->punitorios->ListViewValue() ?></div>
</td>
	<?php } ?>
	<?php if ($ReporteCuotas->estado->Visible) { // estado ?>
		<td<?php echo $ReporteCuotas->estado->CellAttributes() ?>>
<div<?php echo $ReporteCuotas->estado->ViewAttributes() ?>><?php echo $ReporteCuotas->estado->ListViewValue() ?></div>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$ReporteCuotas_list->ListOptions->Render("body", "right");
?>
	</tr>
<?php
	}
	if ($ReporteCuotas->CurrentAction <> "gridadd")
		$rs->MoveNext();
}
?>
</tbody>
</table>
<?php } ?>
</div>
</form>
<?php

// Close recordset
if ($rs)
	$rs->Close();
?>
<?php if ($ReporteCuotas->Export == "") { ?>
<div class="ewGridLowerPanel">
<?php if ($ReporteCuotas->CurrentAction <> "gridadd" && $ReporteCuotas->CurrentAction <> "gridedit") { ?>
<form name="ewpagerform" id="ewpagerform" class="ewForm" action="<?php echo ew_CurrentPage() ?>">
<table border="0" cellspacing="0" cellpadding="0" class="ewPager">
	<tr>
		<td nowrap>
<?php if (!isset($ReporteCuotas_list->Pager)) $ReporteCuotas_list->Pager = new cPrevNextPager($ReporteCuotas_list->lStartRec, $ReporteCuotas_list->lDisplayRecs, $ReporteCuotas_list->lTotalRecs) ?>
<?php if ($ReporteCuotas_list->Pager->RecordCount > 0) { ?>
	<table border="0" cellspacing="0" cellpadding="0"><tr><td><span class="phpmaker"><?php echo $Language->Phrase("Page") ?>&nbsp;</span></td>
<!--first page button-->
	<?php if ($ReporteCuotas_list->Pager->FirstButton->Enabled) { ?>
	<td><a href="<?php echo $ReporteCuotas_list->PageUrl() ?>start=<?php echo $ReporteCuotas_list->Pager->FirstButton->Start ?>"><img src="images/first.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/firstdisab.gif" alt="<?php echo $Language->Phrase("PagerFirst") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--previous page button-->
	<?php if ($ReporteCuotas_list->Pager->PrevButton->Enabled) { ?>
	<td><a href="<?php echo $ReporteCuotas_list->PageUrl() ?>start=<?php echo $ReporteCuotas_list->Pager->PrevButton->Start ?>"><img src="images/prev.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></a></td>
	<?php } else { ?>
	<td><img src="images/prevdisab.gif" alt="<?php echo $Language->Phrase("PagerPrevious") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--current page number-->
	<td><input type="text" name="<?php echo EW_TABLE_PAGE_NO ?>" id="<?php echo EW_TABLE_PAGE_NO ?>" value="<?php echo $ReporteCuotas_list->Pager->CurrentPage ?>" size="4"></td>
<!--next page button-->
	<?php if ($ReporteCuotas_list->Pager->NextButton->Enabled) { ?>
	<td><a href="<?php echo $ReporteCuotas_list->PageUrl() ?>start=<?php echo $ReporteCuotas_list->Pager->NextButton->Start ?>"><img src="images/next.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/nextdisab.gif" alt="<?php echo $Language->Phrase("PagerNext") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
<!--last page button-->
	<?php if ($ReporteCuotas_list->Pager->LastButton->Enabled) { ?>
	<td><a href="<?php echo $ReporteCuotas_list->PageUrl() ?>start=<?php echo $ReporteCuotas_list->Pager->LastButton->Start ?>"><img src="images/last.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></a></td>	
	<?php } else { ?>
	<td><img src="images/lastdisab.gif" alt="<?php echo $Language->Phrase("PagerLast") ?>" width="16" height="16" border="0"></td>
	<?php } ?>
	<td><span class="phpmaker">&nbsp;<?php echo $Language->Phrase("of") ?>&nbsp;<?php echo $ReporteCuotas_list->Pager->PageCount ?></span></td>
	</tr></table>
	</td>	
	<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
	<td>
	<span class="phpmaker"><?php echo $Language->Phrase("Record") ?>&nbsp;<?php echo $ReporteCuotas_list->Pager->FromIndex ?>&nbsp;<?php echo $Language->Phrase("To") ?>&nbsp;<?php echo $ReporteCuotas_list->Pager->ToIndex ?>&nbsp;<?php echo $Language->Phrase("Of") ?>&nbsp;<?php echo $ReporteCuotas_list->Pager->RecordCount ?></span>
<?php } else { ?>
	<?php if ($ReporteCuotas_list->sSrchWhere == "0=101") { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("EnterSearchCriteria") ?></span>
	<?php } else { ?>
	<span class="phpmaker"><?php echo $Language->Phrase("NoRecord") ?></span>
	<?php } ?>
<?php } ?>
		</td>
<?php if ($ReporteCuotas_list->lTotalRecs > 0) { ?>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td><table border="0" cellspacing="0" cellpadding="0"><tr><td><?php echo $Language->Phrase("RecordsPerPage") ?>&nbsp;</td><td>
<input type="hidden" id="t" name="t" value="ReporteCuotas">
<select name="<?php echo EW_TABLE_REC_PER_PAGE ?>" id="<?php echo EW_TABLE_REC_PER_PAGE ?>" onchange="this.form.submit();">
<option value="20"<?php if ($ReporteCuotas_list->lDisplayRecs == 20) { ?> selected="selected"<?php } ?>>20</option>
<option value="40"<?php if ($ReporteCuotas_list->lDisplayRecs == 40) { ?> selected="selected"<?php } ?>>40</option>
<option value="60"<?php if ($ReporteCuotas_list->lDisplayRecs == 60) { ?> selected="selected"<?php } ?>>60</option>
<option value="ALL"<?php if ($ReporteCuotas->getRecordsPerPage() == -1) { ?> selected="selected"<?php } ?>><?php echo $Language->Phrase("AllRecords") ?></option>
</select></td></tr></table>
		</td>
<?php } ?>
	</tr>
</table>
</form>
<?php } ?>
<?php //if ($ReporteCuotas_list->lTotalRecs > 0) { ?>
<span class="phpmaker">
</span>
<?php //} ?>
</div>
<?php } ?>
</td></tr></table>
<?php if ($ReporteCuotas->Export == "" && $ReporteCuotas->CurrentAction == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--
ew_UpdateOpts([['x_id','x_id',false]]);

//-->
</script>
<?php } ?>
<?php if ($ReporteCuotas->Export == "") { ?>
<script language="JavaScript" type="text/javascript">
<!--

// Write your table-specific startup script here
// document.write("page loaded");
//-->

</script>
<?php } ?>
<?php include "footer.php" ?>
<?php
$ReporteCuotas_list->Page_Terminate();
?>
<?php

//
// Page class
//
class cReporteCuotas_list {

	// Page ID
	var $PageID = 'list';

	// Table name
	var $TableName = 'ReporteCuotas';

	// Page object name
	var $PageObjName = 'ReporteCuotas_list';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		global $ReporteCuotas;
		if ($ReporteCuotas->UseTokenInUrl) $PageUrl .= "t=" . $ReporteCuotas->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Page URLs
	var $AddUrl;
	var $EditUrl;
	var $CopyUrl;
	var $DeleteUrl;
	var $ViewUrl;
	var $ListUrl;

	// Export URLs
	var $ExportPrintUrl;
	var $ExportHtmlUrl;
	var $ExportExcelUrl;
	var $ExportWordUrl;
	var $ExportXmlUrl;
	var $ExportCsvUrl;

	// Update URLs
	var $InlineAddUrl;
	var $InlineCopyUrl;
	var $InlineEditUrl;
	var $GridAddUrl;
	var $GridEditUrl;
	var $MultiDeleteUrl;
	var $MultiUpdateUrl;

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		if (@$_SESSION[EW_SESSION_MESSAGE] <> "") { // Append
			$_SESSION[EW_SESSION_MESSAGE] .= "<br>" . $v;
		} else {
			$_SESSION[EW_SESSION_MESSAGE] = $v;
		}
	}

	// Show message
	function ShowMessage() {
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage);
		if ($sMessage <> "") { // Message in Session, display
			echo "<p><span class=\"ewMessage\">" . $sMessage . "</span></p>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm, $ReporteCuotas;
		if ($ReporteCuotas->UseTokenInUrl) {
			if ($objForm)
				return ($ReporteCuotas->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($ReporteCuotas->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function cReporteCuotas_list() {
		global $conn, $Language;

		// Language object
		$Language = new cLanguage();

		// Table object (ReporteCuotas)
		$GLOBALS["ReporteCuotas"] = new cReporteCuotas();

		// Initialize URLs
		$this->ExportPrintUrl = $this->PageUrl() . "export=print";
		$this->ExportExcelUrl = $this->PageUrl() . "export=excel";
		$this->ExportWordUrl = $this->PageUrl() . "export=word";
		$this->ExportHtmlUrl = $this->PageUrl() . "export=html";
		$this->ExportXmlUrl = $this->PageUrl() . "export=xml";
		$this->ExportCsvUrl = $this->PageUrl() . "export=csv";
		$this->AddUrl = $GLOBALS["ReporteCuotas"]->AddUrl();
		$this->InlineAddUrl = $this->PageUrl() . "a=add";
		$this->GridAddUrl = $this->PageUrl() . "a=gridadd";
		$this->GridEditUrl = $this->PageUrl() . "a=gridedit";
		$this->MultiDeleteUrl = "ReporteCuotasdelete.php";
		$this->MultiUpdateUrl = "ReporteCuotasupdate.php";

		// Table object (usuarios)
		$GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'list', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'ReporteCuotas', TRUE);

		// Start timer
		$GLOBALS["gsTimer"] = new cTimer();

		// Open connection
		$conn = ew_Connect();

		// List options
		$this->ListOptions = new cListOptions();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;
		global $ReporteCuotas;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}

		// Get export parameters
		if (@$_GET["export"] <> "") {
			$ReporteCuotas->Export = $_GET["export"];
		} elseif (ew_IsHttpPost()) {
			if (@$_POST["exporttype"] <> "")
				$ReporteCuotas->Export = $_POST["exporttype"];
		} else {
			$ReporteCuotas->setExportReturnUrl(ew_CurrentUrl());
		}
		$gsExport = $ReporteCuotas->Export; // Get export parameter, used in header
		$gsExportFile = $ReporteCuotas->TableVar; // Get export file, used in header
		if (in_array($ReporteCuotas->Export, array("html", "email", "excel", "word")))
			echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
		if ($ReporteCuotas->Export == "excel") {
			header('Content-Type: application/vnd.ms-excel;charset=utf-8');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.xls');
		}
		if ($ReporteCuotas->Export == "csv") {
			header('Content-Type: application/csv;charset=utf-8');
			header('Content-Disposition: attachment; filename=' . $gsExportFile .'.csv');
		}

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		$this->Page_Redirecting($url);
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}

	// Class variables
	var $ListOptions; // List options
	var $lDisplayRecs = 20;
	var $lStartRec;
	var $lStopRec;
	var $lTotalRecs = 0;
	var $lRecRange = 10;
	var $sSrchWhere = ""; // Search WHERE clause
	var $lRecCnt = 0; // Record count
	var $lEditRowCnt;
	var $lRowCnt;
	var $lRowIndex; // Row index
	var $lRecPerRow = 0;
	var $lColCnt = 0;
	var $sDbMasterFilter = ""; // Master filter
	var $sDbDetailFilter = ""; // Detail filter
	var $bMasterRecordExists;	
	var $sMultiSelectKey;
	var $RestoreSearch;

	//
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsSearchError, $Security, $ReporteCuotas;

		// Search filters
		$sSrchAdvanced = ""; // Advanced search filter
		$sSrchBasic = ""; // Basic search filter
		$sFilter = "";
		if ($this->IsPageRequest()) { // Validate request

			// Set up records per page
			$this->SetUpDisplayRecs();

			// Handle reset command
			$this->ResetCmd();

			// Set up list options
			$this->SetupListOptions();

			// Get basic search values
			$this->LoadBasicSearchValues();

			// Get and validate search values for advanced search
			$this->LoadSearchValues(); // Get search values
			if (!$this->ValidateSearch())
				$this->setMessage($gsSearchError);

			// Restore search parms from Session
			$this->RestoreSearchParms();

			// Call Recordset SearchValidated event
			$ReporteCuotas->Recordset_SearchValidated();

			// Set up sorting order
			$this->SetUpSortOrder();

			// Get basic search criteria
			if ($gsSearchError == "")
				$sSrchBasic = $this->BasicSearchWhere();

			// Get search criteria for advanced search
			if ($gsSearchError == "")
				$sSrchAdvanced = $this->AdvancedSearchWhere();
		}

		// Restore display records
		if ($ReporteCuotas->getRecordsPerPage() <> "") {
			$this->lDisplayRecs = $ReporteCuotas->getRecordsPerPage(); // Restore from Session
		} else {
			$this->lDisplayRecs = 20; // Load default
		}

		// Load Sorting Order
		$this->LoadSortOrder();

		// Build search criteria
		if ($sSrchAdvanced <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchAdvanced . ")" : $sSrchAdvanced;
		if ($sSrchBasic <> "")
			$this->sSrchWhere = ($this->sSrchWhere <> "") ? "(" . $this->sSrchWhere . ") AND (" . $sSrchBasic. ")" : $sSrchBasic;

		// Call Recordset_Searching event
		$ReporteCuotas->Recordset_Searching($this->sSrchWhere);

		// Save search criteria
		if ($this->sSrchWhere <> "") {
			if ($sSrchBasic == "")
				$this->ResetBasicSearchParms();
			if ($sSrchAdvanced == "")
				$this->ResetAdvancedSearchParms();
			$ReporteCuotas->setSearchWhere($this->sSrchWhere); // Save to Session
			if (!$this->RestoreSearch) {
				$this->lStartRec = 1; // Reset start record counter
				$ReporteCuotas->setStartRecordNumber($this->lStartRec);
			}
		} else {
			$this->sSrchWhere = $ReporteCuotas->getSearchWhere();
		}

		// Build filter
		$sFilter = "";
		if ($this->sDbDetailFilter <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (" . $this->sDbDetailFilter . ")" : $this->sDbDetailFilter;
		if ($this->sSrchWhere <> "")
			$sFilter = ($sFilter <> "") ? "(" . $sFilter . ") AND (". $this->sSrchWhere . ")" : $this->sSrchWhere;

		// Set up filter in session
		$ReporteCuotas->setSessionWhere($sFilter);
		$ReporteCuotas->CurrentFilter = "";

		// Export data only
		if (in_array($ReporteCuotas->Export, array("html","word","excel","xml","csv","email"))) {
			$this->ExportData();
			if ($ReporteCuotas->Export <> "email")
				$this->Page_Terminate(); // Terminate response
			exit();
		}
	}

	// Set up number of records displayed per page
	function SetUpDisplayRecs() {
		global $ReporteCuotas;
		$sWrk = @$_GET[EW_TABLE_REC_PER_PAGE];
		if ($sWrk <> "") {
			if (is_numeric($sWrk)) {
				$this->lDisplayRecs = intval($sWrk);
			} else {
				if (strtolower($sWrk) == "all") { // Display all records
					$this->lDisplayRecs = -1;
				} else {
					$this->lDisplayRecs = 20; // Non-numeric, load default
				}
			}
			$ReporteCuotas->setRecordsPerPage($this->lDisplayRecs); // Save to Session

			// Reset start position
			$this->lStartRec = 1;
			$ReporteCuotas->setStartRecordNumber($this->lStartRec);
		}
	}

	// Advanced search WHERE clause based on QueryString
	function AdvancedSearchWhere() {
		global $Security, $ReporteCuotas;
		$sWhere = "";
		$this->BuildSearchSql($sWhere, $ReporteCuotas->Creditos, FALSE); // Creditos
		$this->BuildSearchSql($sWhere, $ReporteCuotas->Financiera, FALSE); // Financiera
		$this->BuildSearchSql($sWhere, $ReporteCuotas->id, FALSE); // id
		$this->BuildSearchSql($sWhere, $ReporteCuotas->Expr1, FALSE); // Expr1
		$this->BuildSearchSql($sWhere, $ReporteCuotas->Nombre, FALSE); // Nombre
		$this->BuildSearchSql($sWhere, $ReporteCuotas->Apellido, FALSE); // Apellido
		$this->BuildSearchSql($sWhere, $ReporteCuotas->Dni, FALSE); // Dni
		$this->BuildSearchSql($sWhere, $ReporteCuotas->cuota, FALSE); // cuota
		$this->BuildSearchSql($sWhere, $ReporteCuotas->vencimiento, FALSE); // vencimiento
		$this->BuildSearchSql($sWhere, $ReporteCuotas->capital, FALSE); // capital
		$this->BuildSearchSql($sWhere, $ReporteCuotas->intereses, FALSE); // intereses
		$this->BuildSearchSql($sWhere, $ReporteCuotas->total, FALSE); // total
		$this->BuildSearchSql($sWhere, $ReporteCuotas->saldo, FALSE); // saldo
		$this->BuildSearchSql($sWhere, $ReporteCuotas->punitorios, FALSE); // punitorios
		$this->BuildSearchSql($sWhere, $ReporteCuotas->estado, FALSE); // estado

		// Set up search parm
		if ($sWhere <> "") {
			$this->SetSearchParm($ReporteCuotas->Creditos); // Creditos
			$this->SetSearchParm($ReporteCuotas->Financiera); // Financiera
			$this->SetSearchParm($ReporteCuotas->id); // id
			$this->SetSearchParm($ReporteCuotas->Expr1); // Expr1
			$this->SetSearchParm($ReporteCuotas->Nombre); // Nombre
			$this->SetSearchParm($ReporteCuotas->Apellido); // Apellido
			$this->SetSearchParm($ReporteCuotas->Dni); // Dni
			$this->SetSearchParm($ReporteCuotas->cuota); // cuota
			$this->SetSearchParm($ReporteCuotas->vencimiento); // vencimiento
			$this->SetSearchParm($ReporteCuotas->capital); // capital
			$this->SetSearchParm($ReporteCuotas->intereses); // intereses
			$this->SetSearchParm($ReporteCuotas->total); // total
			$this->SetSearchParm($ReporteCuotas->saldo); // saldo
			$this->SetSearchParm($ReporteCuotas->punitorios); // punitorios
			$this->SetSearchParm($ReporteCuotas->estado); // estado
		}
		return $sWhere;
	}

	// Build search SQL
	function BuildSearchSql(&$Where, &$Fld, $MultiValue) {
		$FldParm = substr($Fld->FldVar, 2);		
		$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
		$FldOpr = $Fld->AdvancedSearch->SearchOperator; // @$_GET["z_$FldParm"]
		$FldCond = $Fld->AdvancedSearch->SearchCondition; // @$_GET["v_$FldParm"]
		$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
		$FldOpr2 = $Fld->AdvancedSearch->SearchOperator2; // @$_GET["w_$FldParm"]
		$sWrk = "";

		//$FldVal = ew_StripSlashes($FldVal);
		if (is_array($FldVal)) $FldVal = implode(",", $FldVal);

		//$FldVal2 = ew_StripSlashes($FldVal2);
		if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
		$FldOpr = strtoupper(trim($FldOpr));
		if ($FldOpr == "") $FldOpr = "=";
		$FldOpr2 = strtoupper(trim($FldOpr2));
		if ($FldOpr2 == "") $FldOpr2 = "=";
		if (EW_SEARCH_MULTI_VALUE_OPTION == 1 || $FldOpr <> "LIKE" ||
			($FldOpr2 <> "LIKE" && $FldVal2 <> ""))
			$MultiValue = FALSE;
		if ($MultiValue) {
			$sWrk1 = ($FldVal <> "") ? ew_GetMultiSearchSql($Fld, $FldVal) : ""; // Field value 1
			$sWrk2 = ($FldVal2 <> "") ? ew_GetMultiSearchSql($Fld, $FldVal2) : ""; // Field value 2
			$sWrk = $sWrk1; // Build final SQL
			if ($sWrk2 <> "")
				$sWrk = ($sWrk <> "") ? "($sWrk) $FldCond ($sWrk2)" : $sWrk2;
		} else {
			$FldVal = $this->ConvertSearchValue($Fld, $FldVal);
			$FldVal2 = $this->ConvertSearchValue($Fld, $FldVal2);
			$sWrk = ew_GetSearchSql($Fld, $FldVal, $FldOpr, $FldCond, $FldVal2, $FldOpr2);
		}
		if ($sWrk <> "") {
			if ($Where <> "") $Where .= " AND ";
			$Where .= "(" . $sWrk . ")";
		}
	}

	// Set search parameters
	function SetSearchParm(&$Fld) {
		global $ReporteCuotas;
		$FldParm = substr($Fld->FldVar, 2);
		$FldVal = $Fld->AdvancedSearch->SearchValue; // @$_GET["x_$FldParm"]
		$FldVal = ew_StripSlashes($FldVal);
		if (is_array($FldVal)) $FldVal = implode(",", $FldVal);
		$FldVal2 = $Fld->AdvancedSearch->SearchValue2; // @$_GET["y_$FldParm"]
		$FldVal2 = ew_StripSlashes($FldVal2);
		if (is_array($FldVal2)) $FldVal2 = implode(",", $FldVal2);
		$ReporteCuotas->setAdvancedSearch("x_$FldParm", $FldVal);
		$ReporteCuotas->setAdvancedSearch("z_$FldParm", $Fld->AdvancedSearch->SearchOperator); // @$_GET["z_$FldParm"]
		$ReporteCuotas->setAdvancedSearch("v_$FldParm", $Fld->AdvancedSearch->SearchCondition); // @$_GET["v_$FldParm"]
		$ReporteCuotas->setAdvancedSearch("y_$FldParm", $FldVal2);
		$ReporteCuotas->setAdvancedSearch("w_$FldParm", $Fld->AdvancedSearch->SearchOperator2); // @$_GET["w_$FldParm"]
	}

	// Get search parameters
	function GetSearchParm(&$Fld) {
		global $ReporteCuotas;
		$FldParm = substr($Fld->FldVar, 2);
		$Fld->AdvancedSearch->SearchValue = $ReporteCuotas->GetAdvancedSearch("x_$FldParm");
		$Fld->AdvancedSearch->SearchOperator = $ReporteCuotas->GetAdvancedSearch("z_$FldParm");
		$Fld->AdvancedSearch->SearchCondition = $ReporteCuotas->GetAdvancedSearch("v_$FldParm");
		$Fld->AdvancedSearch->SearchValue2 = $ReporteCuotas->GetAdvancedSearch("y_$FldParm");
		$Fld->AdvancedSearch->SearchOperator2 = $ReporteCuotas->GetAdvancedSearch("w_$FldParm");
	}

	// Convert search value
	function ConvertSearchValue(&$Fld, $FldVal) {
		$Value = $FldVal;
		if ($Fld->FldDataType == EW_DATATYPE_BOOLEAN) {
			if ($FldVal <> "") $Value = ($FldVal == "1") ? $Fld->TrueValue : $Fld->FalseValue;
		} elseif ($Fld->FldDataType == EW_DATATYPE_DATE) {
			if ($FldVal <> "") $Value = ew_UnFormatDateTime($FldVal, $Fld->FldDateTimeFormat);
		}
		return $Value;
	}

	// Return basic search SQL
	function BasicSearchSQL($Keyword) {
		global $ReporteCuotas;
		$sKeyword = ew_AdjustSql($Keyword);
		$sWhere = "";
		if (is_numeric($Keyword)) $this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->Creditos, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->Financiera, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->Expr1, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->Nombre, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->Apellido, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->Dni, $Keyword);
		$this->BuildBasicSearchSQL($sWhere, $ReporteCuotas->vencimiento, $Keyword);
		return $sWhere;
	}

	// Build basic search SQL
	function BuildBasicSearchSql(&$Where, &$Fld, $Keyword) {
		$sFldExpression = ($Fld->FldVirtualExpression <> "") ? $Fld->FldVirtualExpression : $Fld->FldExpression;
		$lFldDataType = ($Fld->FldIsVirtual) ? EW_DATATYPE_STRING : $Fld->FldDataType;
		if ($lFldDataType == EW_DATATYPE_NUMBER) {
			$sWrk = $sFldExpression . " = " . ew_QuotedValue($Keyword, $lFldDataType);
		} else {
			$sWrk = $sFldExpression . " LIKE " . ew_QuotedValue("%" . $Keyword . "%", $lFldDataType);
		}
		if ($Where <> "") $Where .= " OR ";
		$Where .= $sWrk;
	}

	// Return basic search WHERE clause based on search keyword and type
	function BasicSearchWhere() {
		global $Security, $ReporteCuotas;
		$sSearchStr = "";
		$sSearchKeyword = $ReporteCuotas->BasicSearchKeyword;
		$sSearchType = $ReporteCuotas->BasicSearchType;
		if ($sSearchKeyword <> "") {
			$sSearch = trim($sSearchKeyword);
			if ($sSearchType <> "") {
				while (strpos($sSearch, "  ") !== FALSE)
					$sSearch = str_replace("  ", " ", $sSearch);
				$arKeyword = explode(" ", trim($sSearch));
				foreach ($arKeyword as $sKeyword) {
					if ($sSearchStr <> "") $sSearchStr .= " " . $sSearchType . " ";
					$sSearchStr .= "(" . $this->BasicSearchSQL($sKeyword) . ")";
				}
			} else {
				$sSearchStr = $this->BasicSearchSQL($sSearch);
			}
		}
		if ($sSearchKeyword <> "") {
			$ReporteCuotas->setSessionBasicSearchKeyword($sSearchKeyword);
			$ReporteCuotas->setSessionBasicSearchType($sSearchType);
		}
		return $sSearchStr;
	}

	// Clear all search parameters
	function ResetSearchParms() {
		global $ReporteCuotas;

		// Clear search WHERE clause
		$this->sSrchWhere = "";
		$ReporteCuotas->setSearchWhere($this->sSrchWhere);

		// Clear basic search parameters
		$this->ResetBasicSearchParms();

		// Clear advanced search parameters
		$this->ResetAdvancedSearchParms();
	}

	// Clear all basic search parameters
	function ResetBasicSearchParms() {
		global $ReporteCuotas;
		$ReporteCuotas->setSessionBasicSearchKeyword("");
		$ReporteCuotas->setSessionBasicSearchType("");
	}

	// Clear all advanced search parameters
	function ResetAdvancedSearchParms() {
		global $ReporteCuotas;
		$ReporteCuotas->setAdvancedSearch("x_Creditos", "");
		$ReporteCuotas->setAdvancedSearch("x_Financiera", "");
		$ReporteCuotas->setAdvancedSearch("x_id", "");
		$ReporteCuotas->setAdvancedSearch("x_Expr1", "");
		$ReporteCuotas->setAdvancedSearch("x_Nombre", "");
		$ReporteCuotas->setAdvancedSearch("x_Apellido", "");
		$ReporteCuotas->setAdvancedSearch("x_Dni", "");
		$ReporteCuotas->setAdvancedSearch("x_cuota", "");
		$ReporteCuotas->setAdvancedSearch("x_vencimiento", "");
		$ReporteCuotas->setAdvancedSearch("v_vencimiento", "AND");
		$ReporteCuotas->setAdvancedSearch("y_vencimiento", "");
		$ReporteCuotas->setAdvancedSearch("x_capital", "");
		$ReporteCuotas->setAdvancedSearch("x_intereses", "");
		$ReporteCuotas->setAdvancedSearch("x_total", "");
		$ReporteCuotas->setAdvancedSearch("x_saldo", "");
		$ReporteCuotas->setAdvancedSearch("x_punitorios", "");
		$ReporteCuotas->setAdvancedSearch("x_estado", "");
	}

	// Restore all search parameters
	function RestoreSearchParms() {
		global $ReporteCuotas;
		$bRestore = TRUE;
		if (@$_GET[EW_TABLE_BASIC_SEARCH] <> "") $bRestore = FALSE;
		if (@$_GET["x_Creditos"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Financiera"] <> "") $bRestore = FALSE;
		if (@$_GET["x_id"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Expr1"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Nombre"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Apellido"] <> "") $bRestore = FALSE;
		if (@$_GET["x_Dni"] <> "") $bRestore = FALSE;
		if (@$_GET["x_cuota"] <> "") $bRestore = FALSE;
		if (@$_GET["x_vencimiento"] <> "") $bRestore = FALSE;
		if (@$_GET["y_vencimiento"] <> "") $bRestore = FALSE;
		if (@$_GET["x_capital"] <> "") $bRestore = FALSE;
		if (@$_GET["x_intereses"] <> "") $bRestore = FALSE;
		if (@$_GET["x_total"] <> "") $bRestore = FALSE;
		if (@$_GET["x_saldo"] <> "") $bRestore = FALSE;
		if (@$_GET["x_punitorios"] <> "") $bRestore = FALSE;
		if (@$_GET["x_estado"] <> "") $bRestore = FALSE;
		$this->RestoreSearch = $bRestore;
		if ($bRestore) {

			// Restore basic search values
			$ReporteCuotas->BasicSearchKeyword = $ReporteCuotas->getSessionBasicSearchKeyword();
			$ReporteCuotas->BasicSearchType = $ReporteCuotas->getSessionBasicSearchType();

			// Restore advanced search values
			$this->GetSearchParm($ReporteCuotas->Creditos);
			$this->GetSearchParm($ReporteCuotas->Financiera);
			$this->GetSearchParm($ReporteCuotas->id);
			$this->GetSearchParm($ReporteCuotas->Expr1);
			$this->GetSearchParm($ReporteCuotas->Nombre);
			$this->GetSearchParm($ReporteCuotas->Apellido);
			$this->GetSearchParm($ReporteCuotas->Dni);
			$this->GetSearchParm($ReporteCuotas->cuota);
			$this->GetSearchParm($ReporteCuotas->vencimiento);
			$this->GetSearchParm($ReporteCuotas->capital);
			$this->GetSearchParm($ReporteCuotas->intereses);
			$this->GetSearchParm($ReporteCuotas->total);
			$this->GetSearchParm($ReporteCuotas->saldo);
			$this->GetSearchParm($ReporteCuotas->punitorios);
			$this->GetSearchParm($ReporteCuotas->estado);
		}
	}

	// Set up sort parameters
	function SetUpSortOrder() {
		global $ReporteCuotas;

		// Check for "order" parameter
		if (@$_GET["order"] <> "") {
			$ReporteCuotas->CurrentOrder = ew_StripSlashes(@$_GET["order"]);
			$ReporteCuotas->CurrentOrderType = @$_GET["ordertype"];
			$ReporteCuotas->UpdateSort($ReporteCuotas->Creditos); // Creditos
			$ReporteCuotas->UpdateSort($ReporteCuotas->Financiera); // Financiera
			$ReporteCuotas->UpdateSort($ReporteCuotas->id); // id
			$ReporteCuotas->UpdateSort($ReporteCuotas->Nombre); // Nombre
			$ReporteCuotas->UpdateSort($ReporteCuotas->Apellido); // Apellido
			$ReporteCuotas->UpdateSort($ReporteCuotas->Dni); // Dni
			$ReporteCuotas->UpdateSort($ReporteCuotas->cuota); // cuota
			$ReporteCuotas->UpdateSort($ReporteCuotas->vencimiento); // vencimiento
			$ReporteCuotas->UpdateSort($ReporteCuotas->capital); // capital
			$ReporteCuotas->UpdateSort($ReporteCuotas->intereses); // intereses
			$ReporteCuotas->UpdateSort($ReporteCuotas->total); // total
			$ReporteCuotas->UpdateSort($ReporteCuotas->saldo); // saldo
			$ReporteCuotas->UpdateSort($ReporteCuotas->punitorios); // punitorios
			$ReporteCuotas->UpdateSort($ReporteCuotas->estado); // estado
			$ReporteCuotas->setStartRecordNumber(1); // Reset start position
		}
	}

	// Load sort order parameters
	function LoadSortOrder() {
		global $ReporteCuotas;
		$sOrderBy = $ReporteCuotas->getSessionOrderBy(); // Get ORDER BY from Session
		if ($sOrderBy == "") {
			if ($ReporteCuotas->SqlOrderBy() <> "") {
				$sOrderBy = $ReporteCuotas->SqlOrderBy();
				$ReporteCuotas->setSessionOrderBy($sOrderBy);
			}
		}
	}

	// Reset command
	// cmd=reset (Reset search parameters)
	// cmd=resetall (Reset search and master/detail parameters)
	// cmd=resetsort (Reset sort parameters)
	function ResetCmd() {
		global $ReporteCuotas;

		// Get reset command
		if (@$_GET["cmd"] <> "") {
			$sCmd = $_GET["cmd"];

			// Reset search criteria
			if (strtolower($sCmd) == "reset" || strtolower($sCmd) == "resetall")
				$this->ResetSearchParms();

			// Reset sorting order
			if (strtolower($sCmd) == "resetsort") {
				$sOrderBy = "";
				$ReporteCuotas->setSessionOrderBy($sOrderBy);
				$ReporteCuotas->Creditos->setSort("");
				$ReporteCuotas->Financiera->setSort("");
				$ReporteCuotas->id->setSort("");
				$ReporteCuotas->Nombre->setSort("");
				$ReporteCuotas->Apellido->setSort("");
				$ReporteCuotas->Dni->setSort("");
				$ReporteCuotas->cuota->setSort("");
				$ReporteCuotas->vencimiento->setSort("");
				$ReporteCuotas->capital->setSort("");
				$ReporteCuotas->intereses->setSort("");
				$ReporteCuotas->total->setSort("");
				$ReporteCuotas->saldo->setSort("");
				$ReporteCuotas->punitorios->setSort("");
				$ReporteCuotas->estado->setSort("");
			}

			// Reset start position
			$this->lStartRec = 1;
			$ReporteCuotas->setStartRecordNumber($this->lStartRec);
		}
	}

	// Set up list options
	function SetupListOptions() {
		global $Security, $ReporteCuotas;

		// Call ListOptions_Load event
		$this->ListOptions_Load();
		if ($ReporteCuotas->Export <> "" ||
			$ReporteCuotas->CurrentAction == "gridadd" ||
			$ReporteCuotas->CurrentAction == "gridedit")
			$this->ListOptions->HideAllOptions();
	}

	// Render list options
	function RenderListOptions() {
		global $Security, $Language, $ReporteCuotas;
		$this->ListOptions->LoadDefault();
		$this->RenderListOptionsExt();

		// Call ListOptions_Rendered event
		$this->ListOptions_Rendered();
	}

	function RenderListOptionsExt() {
		global $Security, $Language, $ReporteCuotas;
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		global $ReporteCuotas;
		if ($this->lDisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->lStartRec = $_GET[EW_TABLE_START_REC];
				$ReporteCuotas->setStartRecordNumber($this->lStartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$this->nPageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($this->nPageNo)) {
					$this->lStartRec = ($this->nPageNo-1)*$this->lDisplayRecs+1;
					if ($this->lStartRec <= 0) {
						$this->lStartRec = 1;
					} elseif ($this->lStartRec >= intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1) {
						$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1;
					}
					$ReporteCuotas->setStartRecordNumber($this->lStartRec);
				}
			}
		}
		$this->lStartRec = $ReporteCuotas->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->lStartRec) || $this->lStartRec == "") { // Avoid invalid start record counter
			$this->lStartRec = 1; // Reset start record counter
			$ReporteCuotas->setStartRecordNumber($this->lStartRec);
		} elseif (intval($this->lStartRec) > intval($this->lTotalRecs)) { // Avoid starting record > total records
			$this->lStartRec = intval(($this->lTotalRecs-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to last page first record
			$ReporteCuotas->setStartRecordNumber($this->lStartRec);
		} elseif (($this->lStartRec-1) % $this->lDisplayRecs <> 0) {
			$this->lStartRec = intval(($this->lStartRec-1)/$this->lDisplayRecs)*$this->lDisplayRecs+1; // Point to page boundary
			$ReporteCuotas->setStartRecordNumber($this->lStartRec);
		}
	}

	// Load basic search values
	function LoadBasicSearchValues() {
		global $ReporteCuotas;
		$ReporteCuotas->BasicSearchKeyword = @$_GET[EW_TABLE_BASIC_SEARCH];
		$ReporteCuotas->BasicSearchType = @$_GET[EW_TABLE_BASIC_SEARCH_TYPE];
	}

	//  Load search values for validation
	function LoadSearchValues() {
		global $objForm, $ReporteCuotas;

		// Load search values
		// Creditos

		$ReporteCuotas->Creditos->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Creditos"]);
		$ReporteCuotas->Creditos->AdvancedSearch->SearchOperator = @$_GET["z_Creditos"];

		// Financiera
		$ReporteCuotas->Financiera->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Financiera"]);
		$ReporteCuotas->Financiera->AdvancedSearch->SearchOperator = @$_GET["z_Financiera"];

		// id
		$ReporteCuotas->id->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_id"]);
		$ReporteCuotas->id->AdvancedSearch->SearchOperator = @$_GET["z_id"];

		// Expr1
		$ReporteCuotas->Expr1->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Expr1"]);
		$ReporteCuotas->Expr1->AdvancedSearch->SearchOperator = @$_GET["z_Expr1"];

		// Nombre
		$ReporteCuotas->Nombre->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Nombre"]);
		$ReporteCuotas->Nombre->AdvancedSearch->SearchOperator = @$_GET["z_Nombre"];

		// Apellido
		$ReporteCuotas->Apellido->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Apellido"]);
		$ReporteCuotas->Apellido->AdvancedSearch->SearchOperator = @$_GET["z_Apellido"];

		// Dni
		$ReporteCuotas->Dni->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_Dni"]);
		$ReporteCuotas->Dni->AdvancedSearch->SearchOperator = @$_GET["z_Dni"];

		// cuota
		$ReporteCuotas->cuota->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_cuota"]);
		$ReporteCuotas->cuota->AdvancedSearch->SearchOperator = @$_GET["z_cuota"];

		// vencimiento
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_vencimiento"]);
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchOperator = @$_GET["z_vencimiento"];
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchCondition = @$_GET["v_vencimiento"];
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchValue2 = ew_StripSlashes(@$_GET["y_vencimiento"]);
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchOperator2 = @$_GET["w_vencimiento"];

		// capital
		$ReporteCuotas->capital->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_capital"]);
		$ReporteCuotas->capital->AdvancedSearch->SearchOperator = @$_GET["z_capital"];

		// intereses
		$ReporteCuotas->intereses->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_intereses"]);
		$ReporteCuotas->intereses->AdvancedSearch->SearchOperator = @$_GET["z_intereses"];

		// total
		$ReporteCuotas->total->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_total"]);
		$ReporteCuotas->total->AdvancedSearch->SearchOperator = @$_GET["z_total"];

		// saldo
		$ReporteCuotas->saldo->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_saldo"]);
		$ReporteCuotas->saldo->AdvancedSearch->SearchOperator = @$_GET["z_saldo"];

		// punitorios
		$ReporteCuotas->punitorios->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_punitorios"]);
		$ReporteCuotas->punitorios->AdvancedSearch->SearchOperator = @$_GET["z_punitorios"];

		// estado
		$ReporteCuotas->estado->AdvancedSearch->SearchValue = ew_StripSlashes(@$_GET["x_estado"]);
		$ReporteCuotas->estado->AdvancedSearch->SearchOperator = @$_GET["z_estado"];
	}

	// Load recordset
	function LoadRecordset($offset = -1, $rowcnt = -1) {
		global $conn, $ReporteCuotas;

		// Call Recordset Selecting event
		$ReporteCuotas->Recordset_Selecting($ReporteCuotas->CurrentFilter);

		// Load List page SQL
		$sSql = $ReporteCuotas->SelectSQL();

		// Load recordset
		$rs = ew_LoadRecordset($sSql);

		// Call Recordset Selected event
		$ReporteCuotas->Recordset_Selected($rs);
		return $rs;
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $ReporteCuotas;
		$sFilter = $ReporteCuotas->KeyFilter();

		// Call Row Selecting event
		$ReporteCuotas->Row_Selecting($sFilter);

		// Load SQL based on filter
		$ReporteCuotas->CurrentFilter = $sFilter;
		$sSql = $ReporteCuotas->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values

			// Call Row Selected event
			$ReporteCuotas->Row_Selected($rs);
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn, $ReporteCuotas;
		$ReporteCuotas->Creditos->setDbValue($rs->fields('Creditos'));
		$ReporteCuotas->Financiera->setDbValue($rs->fields('Financiera'));
		$ReporteCuotas->id->setDbValue($rs->fields('id'));
		$ReporteCuotas->Expr1->setDbValue($rs->fields('Expr1'));
		$ReporteCuotas->Nombre->setDbValue($rs->fields('Nombre'));
		$ReporteCuotas->Apellido->setDbValue($rs->fields('Apellido'));
		$ReporteCuotas->Dni->setDbValue($rs->fields('Dni'));
		$ReporteCuotas->cuota->setDbValue($rs->fields('cuota'));
		$ReporteCuotas->vencimiento->setDbValue($rs->fields('vencimiento'));
		$ReporteCuotas->capital->setDbValue($rs->fields('capital'));
		$ReporteCuotas->intereses->setDbValue($rs->fields('intereses'));
		$ReporteCuotas->total->setDbValue($rs->fields('total'));
		$ReporteCuotas->saldo->setDbValue($rs->fields('saldo'));
		$ReporteCuotas->punitorios->setDbValue($rs->fields('punitorios'));
		$ReporteCuotas->estado->setDbValue($rs->fields('estado'));
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language, $ReporteCuotas;

		// Initialize URLs
		$this->ViewUrl = $ReporteCuotas->ViewUrl();
		$this->EditUrl = $ReporteCuotas->EditUrl();
		$this->InlineEditUrl = $ReporteCuotas->InlineEditUrl();
		$this->CopyUrl = $ReporteCuotas->CopyUrl();
		$this->InlineCopyUrl = $ReporteCuotas->InlineCopyUrl();
		$this->DeleteUrl = $ReporteCuotas->DeleteUrl();

		// Call Row_Rendering event
		$ReporteCuotas->Row_Rendering();

		// Common render codes for all row types
		// Creditos

		$ReporteCuotas->Creditos->CellCssStyle = ""; $ReporteCuotas->Creditos->CellCssClass = "";
		$ReporteCuotas->Creditos->CellAttrs = array(); $ReporteCuotas->Creditos->ViewAttrs = array(); $ReporteCuotas->Creditos->EditAttrs = array();

		// Financiera
		$ReporteCuotas->Financiera->CellCssStyle = ""; $ReporteCuotas->Financiera->CellCssClass = "";
		$ReporteCuotas->Financiera->CellAttrs = array(); $ReporteCuotas->Financiera->ViewAttrs = array(); $ReporteCuotas->Financiera->EditAttrs = array();

		// id
		$ReporteCuotas->id->CellCssStyle = ""; $ReporteCuotas->id->CellCssClass = "";
		$ReporteCuotas->id->CellAttrs = array(); $ReporteCuotas->id->ViewAttrs = array(); $ReporteCuotas->id->EditAttrs = array();

		// Nombre
		$ReporteCuotas->Nombre->CellCssStyle = ""; $ReporteCuotas->Nombre->CellCssClass = "";
		$ReporteCuotas->Nombre->CellAttrs = array(); $ReporteCuotas->Nombre->ViewAttrs = array(); $ReporteCuotas->Nombre->EditAttrs = array();

		// Apellido
		$ReporteCuotas->Apellido->CellCssStyle = ""; $ReporteCuotas->Apellido->CellCssClass = "";
		$ReporteCuotas->Apellido->CellAttrs = array(); $ReporteCuotas->Apellido->ViewAttrs = array(); $ReporteCuotas->Apellido->EditAttrs = array();

		// Dni
		$ReporteCuotas->Dni->CellCssStyle = ""; $ReporteCuotas->Dni->CellCssClass = "";
		$ReporteCuotas->Dni->CellAttrs = array(); $ReporteCuotas->Dni->ViewAttrs = array(); $ReporteCuotas->Dni->EditAttrs = array();

		// cuota
		$ReporteCuotas->cuota->CellCssStyle = ""; $ReporteCuotas->cuota->CellCssClass = "";
		$ReporteCuotas->cuota->CellAttrs = array(); $ReporteCuotas->cuota->ViewAttrs = array(); $ReporteCuotas->cuota->EditAttrs = array();

		// vencimiento
		$ReporteCuotas->vencimiento->CellCssStyle = ""; $ReporteCuotas->vencimiento->CellCssClass = "";
		$ReporteCuotas->vencimiento->CellAttrs = array(); $ReporteCuotas->vencimiento->ViewAttrs = array(); $ReporteCuotas->vencimiento->EditAttrs = array();

		// capital
		$ReporteCuotas->capital->CellCssStyle = ""; $ReporteCuotas->capital->CellCssClass = "";
		$ReporteCuotas->capital->CellAttrs = array(); $ReporteCuotas->capital->ViewAttrs = array(); $ReporteCuotas->capital->EditAttrs = array();

		// intereses
		$ReporteCuotas->intereses->CellCssStyle = ""; $ReporteCuotas->intereses->CellCssClass = "";
		$ReporteCuotas->intereses->CellAttrs = array(); $ReporteCuotas->intereses->ViewAttrs = array(); $ReporteCuotas->intereses->EditAttrs = array();

		// total
		$ReporteCuotas->total->CellCssStyle = ""; $ReporteCuotas->total->CellCssClass = "";
		$ReporteCuotas->total->CellAttrs = array(); $ReporteCuotas->total->ViewAttrs = array(); $ReporteCuotas->total->EditAttrs = array();

		// saldo
		$ReporteCuotas->saldo->CellCssStyle = ""; $ReporteCuotas->saldo->CellCssClass = "";
		$ReporteCuotas->saldo->CellAttrs = array(); $ReporteCuotas->saldo->ViewAttrs = array(); $ReporteCuotas->saldo->EditAttrs = array();

		// punitorios
		$ReporteCuotas->punitorios->CellCssStyle = ""; $ReporteCuotas->punitorios->CellCssClass = "";
		$ReporteCuotas->punitorios->CellAttrs = array(); $ReporteCuotas->punitorios->ViewAttrs = array(); $ReporteCuotas->punitorios->EditAttrs = array();

		// estado
		$ReporteCuotas->estado->CellCssStyle = ""; $ReporteCuotas->estado->CellCssClass = "";
		$ReporteCuotas->estado->CellAttrs = array(); $ReporteCuotas->estado->ViewAttrs = array(); $ReporteCuotas->estado->EditAttrs = array();
		if ($ReporteCuotas->RowType == EW_ROWTYPE_VIEW) { // View row

			// Creditos
			$ReporteCuotas->Creditos->ViewValue = $ReporteCuotas->Creditos->CurrentValue;
			$ReporteCuotas->Creditos->CssStyle = "";
			$ReporteCuotas->Creditos->CssClass = "";
			$ReporteCuotas->Creditos->ViewCustomAttributes = "";

			// Financiera
			if (strval($ReporteCuotas->Financiera->CurrentValue) <> "") {
				$sFilterWrk = "[id] = " . ew_AdjustSql($ReporteCuotas->Financiera->CurrentValue) . "";
			$sSqlWrk = "SELECT [Nombre] FROM [TipoCreditos]";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$ReporteCuotas->Financiera->ViewValue = $rswrk->fields('Nombre');
					$rswrk->Close();
				} else {
					$ReporteCuotas->Financiera->ViewValue = $ReporteCuotas->Financiera->CurrentValue;
				}
			} else {
				$ReporteCuotas->Financiera->ViewValue = NULL;
			}
			$ReporteCuotas->Financiera->CssStyle = "";
			$ReporteCuotas->Financiera->CssClass = "";
			$ReporteCuotas->Financiera->ViewCustomAttributes = "";

			// id
			if (strval($ReporteCuotas->id->CurrentValue) <> "") {
				$sFilterWrk = "[id] = " . ew_AdjustSql($ReporteCuotas->id->CurrentValue) . "";
			$sSqlWrk = "SELECT [Nombre] FROM [sucursales]";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
				$rswrk = $conn->Execute($sSqlWrk);
				if ($rswrk && !$rswrk->EOF) { // Lookup values found
					$ReporteCuotas->id->ViewValue = $rswrk->fields('Nombre');
					$rswrk->Close();
				} else {
					$ReporteCuotas->id->ViewValue = $ReporteCuotas->id->CurrentValue;
				}
			} else {
				$ReporteCuotas->id->ViewValue = NULL;
			}
			$ReporteCuotas->id->CssStyle = "";
			$ReporteCuotas->id->CssClass = "";
			$ReporteCuotas->id->ViewCustomAttributes = "";

			// Expr1
			$ReporteCuotas->Expr1->ViewValue = $ReporteCuotas->Expr1->CurrentValue;
			$ReporteCuotas->Expr1->CssStyle = "";
			$ReporteCuotas->Expr1->CssClass = "";
			$ReporteCuotas->Expr1->ViewCustomAttributes = "";

			// Nombre
			$ReporteCuotas->Nombre->ViewValue = $ReporteCuotas->Nombre->CurrentValue;
			$ReporteCuotas->Nombre->CssStyle = "";
			$ReporteCuotas->Nombre->CssClass = "";
			$ReporteCuotas->Nombre->ViewCustomAttributes = "";

			// Apellido
			$ReporteCuotas->Apellido->ViewValue = $ReporteCuotas->Apellido->CurrentValue;
			$ReporteCuotas->Apellido->CssStyle = "";
			$ReporteCuotas->Apellido->CssClass = "";
			$ReporteCuotas->Apellido->ViewCustomAttributes = "";

			// Dni
			$ReporteCuotas->Dni->ViewValue = $ReporteCuotas->Dni->CurrentValue;
			$ReporteCuotas->Dni->CssStyle = "";
			$ReporteCuotas->Dni->CssClass = "";
			$ReporteCuotas->Dni->ViewCustomAttributes = "";

			// cuota
			$ReporteCuotas->cuota->ViewValue = $ReporteCuotas->cuota->CurrentValue;
			$ReporteCuotas->cuota->CssStyle = "";
			$ReporteCuotas->cuota->CssClass = "";
			$ReporteCuotas->cuota->ViewCustomAttributes = "";

			// vencimiento
			$ReporteCuotas->vencimiento->ViewValue = $ReporteCuotas->vencimiento->CurrentValue;
			$ReporteCuotas->vencimiento->CssStyle = "";
			$ReporteCuotas->vencimiento->CssClass = "";
			$ReporteCuotas->vencimiento->ViewCustomAttributes = "";

			// capital
			$ReporteCuotas->capital->ViewValue = $ReporteCuotas->capital->CurrentValue;
			$ReporteCuotas->capital->CssStyle = "";
			$ReporteCuotas->capital->CssClass = "";
			$ReporteCuotas->capital->ViewCustomAttributes = "";

			// intereses
			$ReporteCuotas->intereses->ViewValue = $ReporteCuotas->intereses->CurrentValue;
			$ReporteCuotas->intereses->CssStyle = "";
			$ReporteCuotas->intereses->CssClass = "";
			$ReporteCuotas->intereses->ViewCustomAttributes = "";

			// total
			$ReporteCuotas->total->ViewValue = $ReporteCuotas->total->CurrentValue;
			$ReporteCuotas->total->CssStyle = "";
			$ReporteCuotas->total->CssClass = "";
			$ReporteCuotas->total->ViewCustomAttributes = "";

			// saldo
			$ReporteCuotas->saldo->ViewValue = $ReporteCuotas->saldo->CurrentValue;
			$ReporteCuotas->saldo->CssStyle = "";
			$ReporteCuotas->saldo->CssClass = "";
			$ReporteCuotas->saldo->ViewCustomAttributes = "";

			// punitorios
			$ReporteCuotas->punitorios->ViewValue = $ReporteCuotas->punitorios->CurrentValue;
			$ReporteCuotas->punitorios->CssStyle = "";
			$ReporteCuotas->punitorios->CssClass = "";
			$ReporteCuotas->punitorios->ViewCustomAttributes = "";

			// estado
			if (strval($ReporteCuotas->estado->CurrentValue) <> "") {
				switch ($ReporteCuotas->estado->CurrentValue) {
					case "1":
						$ReporteCuotas->estado->ViewValue = "Pendiente";
						break;
					case "2":
						$ReporteCuotas->estado->ViewValue = "Cancelado";
						break;
					case "3":
						$ReporteCuotas->estado->ViewValue = "Refinanciado";
						break;
					case "4":
						$ReporteCuotas->estado->ViewValue = "Anulado";
						break;
					default:
						$ReporteCuotas->estado->ViewValue = $ReporteCuotas->estado->CurrentValue;
				}
			} else {
				$ReporteCuotas->estado->ViewValue = NULL;
			}
			$ReporteCuotas->estado->CssStyle = "";
			$ReporteCuotas->estado->CssClass = "";
			$ReporteCuotas->estado->ViewCustomAttributes = "";

			// Creditos
			$ReporteCuotas->Creditos->HrefValue = "";
			$ReporteCuotas->Creditos->TooltipValue = "";

			// Financiera
			$ReporteCuotas->Financiera->HrefValue = "";
			$ReporteCuotas->Financiera->TooltipValue = "";

			// id
			$ReporteCuotas->id->HrefValue = "";
			$ReporteCuotas->id->TooltipValue = "";

			// Nombre
			$ReporteCuotas->Nombre->HrefValue = "";
			$ReporteCuotas->Nombre->TooltipValue = "";

			// Apellido
			$ReporteCuotas->Apellido->HrefValue = "";
			$ReporteCuotas->Apellido->TooltipValue = "";

			// Dni
			$ReporteCuotas->Dni->HrefValue = "";
			$ReporteCuotas->Dni->TooltipValue = "";

			// cuota
			$ReporteCuotas->cuota->HrefValue = "";
			$ReporteCuotas->cuota->TooltipValue = "";

			// vencimiento
			$ReporteCuotas->vencimiento->HrefValue = "";
			$ReporteCuotas->vencimiento->TooltipValue = "";

			// capital
			$ReporteCuotas->capital->HrefValue = "";
			$ReporteCuotas->capital->TooltipValue = "";

			// intereses
			$ReporteCuotas->intereses->HrefValue = "";
			$ReporteCuotas->intereses->TooltipValue = "";

			// total
			$ReporteCuotas->total->HrefValue = "";
			$ReporteCuotas->total->TooltipValue = "";

			// saldo
			$ReporteCuotas->saldo->HrefValue = "";
			$ReporteCuotas->saldo->TooltipValue = "";

			// punitorios
			$ReporteCuotas->punitorios->HrefValue = "";
			$ReporteCuotas->punitorios->TooltipValue = "";

			// estado
			$ReporteCuotas->estado->HrefValue = "";
			$ReporteCuotas->estado->TooltipValue = "";
		} elseif ($ReporteCuotas->RowType == EW_ROWTYPE_SEARCH) { // Search row

			// Creditos
			$ReporteCuotas->Creditos->EditCustomAttributes = "";
			$ReporteCuotas->Creditos->EditValue = ew_HtmlEncode($ReporteCuotas->Creditos->AdvancedSearch->SearchValue);

			// Financiera
			$ReporteCuotas->Financiera->EditCustomAttributes = "";

			// id
			$ReporteCuotas->id->EditCustomAttributes = "";
			if (trim(strval($ReporteCuotas->id->AdvancedSearch->SearchValue)) == "") {
				$sFilterWrk = "0=1";
			} else {
				$sFilterWrk = "[id] = " . ew_AdjustSql($ReporteCuotas->id->AdvancedSearch->SearchValue) . "";
			}
			$sSqlWrk = "SELECT [id], [Nombre], '' AS Disp2Fld, '' AS SelectFilterFld FROM [sucursales]";
			$sWhereWrk = "";
			if ($sFilterWrk <> "") {
				if ($sWhereWrk <> "") $sWhereWrk .= " AND ";
				$sWhereWrk .= "(" . $sFilterWrk . ")";
			}
			if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
			$rswrk = $conn->Execute($sSqlWrk);
			$arwrk = ($rswrk) ? $rswrk->GetRows() : array();
			if ($rswrk) $rswrk->Close();
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$ReporteCuotas->id->EditValue = $arwrk;

			// Nombre
			$ReporteCuotas->Nombre->EditCustomAttributes = "";
			$ReporteCuotas->Nombre->EditValue = ew_HtmlEncode($ReporteCuotas->Nombre->AdvancedSearch->SearchValue);

			// Apellido
			$ReporteCuotas->Apellido->EditCustomAttributes = "";
			$ReporteCuotas->Apellido->EditValue = ew_HtmlEncode($ReporteCuotas->Apellido->AdvancedSearch->SearchValue);

			// Dni
			$ReporteCuotas->Dni->EditCustomAttributes = "";
			$ReporteCuotas->Dni->EditValue = ew_HtmlEncode($ReporteCuotas->Dni->AdvancedSearch->SearchValue);

			// cuota
			$ReporteCuotas->cuota->EditCustomAttributes = "";
			$ReporteCuotas->cuota->EditValue = ew_HtmlEncode($ReporteCuotas->cuota->AdvancedSearch->SearchValue);

			// vencimiento
			$ReporteCuotas->vencimiento->EditCustomAttributes = "";
			$ReporteCuotas->vencimiento->EditValue = ew_HtmlEncode($ReporteCuotas->vencimiento->AdvancedSearch->SearchValue);
			$ReporteCuotas->vencimiento->EditCustomAttributes = "";
			$ReporteCuotas->vencimiento->EditValue2 = ew_HtmlEncode($ReporteCuotas->vencimiento->AdvancedSearch->SearchValue2);

			// capital
			$ReporteCuotas->capital->EditCustomAttributes = "";
			$ReporteCuotas->capital->EditValue = ew_HtmlEncode($ReporteCuotas->capital->AdvancedSearch->SearchValue);

			// intereses
			$ReporteCuotas->intereses->EditCustomAttributes = "";
			$ReporteCuotas->intereses->EditValue = ew_HtmlEncode($ReporteCuotas->intereses->AdvancedSearch->SearchValue);

			// total
			$ReporteCuotas->total->EditCustomAttributes = "";
			$ReporteCuotas->total->EditValue = ew_HtmlEncode($ReporteCuotas->total->AdvancedSearch->SearchValue);

			// saldo
			$ReporteCuotas->saldo->EditCustomAttributes = "";
			$ReporteCuotas->saldo->EditValue = ew_HtmlEncode($ReporteCuotas->saldo->AdvancedSearch->SearchValue);

			// punitorios
			$ReporteCuotas->punitorios->EditCustomAttributes = "";
			$ReporteCuotas->punitorios->EditValue = ew_HtmlEncode($ReporteCuotas->punitorios->AdvancedSearch->SearchValue);

			// estado
			$ReporteCuotas->estado->EditCustomAttributes = "";
			$arwrk = array();
			$arwrk[] = array("1", "Pendiente");
			$arwrk[] = array("2", "Cancelado");
			$arwrk[] = array("3", "Refinanciado");
			$arwrk[] = array("4", "Anulado");
			array_unshift($arwrk, array("", $Language->Phrase("PleaseSelect")));
			$ReporteCuotas->estado->EditValue = $arwrk;
		}

		// Call Row Rendered event
		if ($ReporteCuotas->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$ReporteCuotas->Row_Rendered();
	}

	// Validate search
	function ValidateSearch() {
		global $gsSearchError, $ReporteCuotas;

		// Initialize
		$gsSearchError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return TRUE;
		if (!ew_CheckInteger($ReporteCuotas->Creditos->AdvancedSearch->SearchValue)) {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $ReporteCuotas->Creditos->FldErrMsg();
		}

		// Return validate result
		$ValidateSearch = ($gsSearchError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateSearch = $ValidateSearch && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			if ($gsSearchError <> "") $gsSearchError .= "<br>";
			$gsSearchError .= $sFormCustomError;
		}
		return $ValidateSearch;
	}

	// Load advanced search
	function LoadAdvancedSearch() {
		global $ReporteCuotas;
		$ReporteCuotas->Creditos->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_Creditos");
		$ReporteCuotas->Financiera->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_Financiera");
		$ReporteCuotas->id->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_id");
		$ReporteCuotas->Expr1->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_Expr1");
		$ReporteCuotas->Nombre->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_Nombre");
		$ReporteCuotas->Apellido->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_Apellido");
		$ReporteCuotas->Dni->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_Dni");
		$ReporteCuotas->cuota->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_cuota");
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_vencimiento");
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchCondition = $ReporteCuotas->getAdvancedSearch("v_vencimiento");
		$ReporteCuotas->vencimiento->AdvancedSearch->SearchValue2 = $ReporteCuotas->getAdvancedSearch("y_vencimiento");
		$ReporteCuotas->capital->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_capital");
		$ReporteCuotas->intereses->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_intereses");
		$ReporteCuotas->total->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_total");
		$ReporteCuotas->saldo->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_saldo");
		$ReporteCuotas->punitorios->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_punitorios");
		$ReporteCuotas->estado->AdvancedSearch->SearchValue = $ReporteCuotas->getAdvancedSearch("x_estado");
	}

	// Export data in HTML/CSV/Word/Excel/XML/Email format
	function ExportData() {
		global $ReporteCuotas;
		$utf8 = TRUE;
		$bSelectLimit = EW_SELECT_LIMIT;

		// Load recordset
		if ($bSelectLimit) {
			$this->lTotalRecs = $ReporteCuotas->SelectRecordCount();
		} else {
			if ($rs = $this->LoadRecordset())
				$this->lTotalRecs = $rs->RecordCount();
		}
		$this->lStartRec = 1;

		// Export all
		if ($ReporteCuotas->ExportAll) {
			$this->lDisplayRecs = $this->lTotalRecs;
			$this->lStopRec = $this->lTotalRecs;
		} else { // Export one page only
			$this->SetUpStartRec(); // Set up start record position

			// Set the last record to display
			if ($this->lDisplayRecs < 0) {
				$this->lStopRec = $this->lTotalRecs;
			} else {
				$this->lStopRec = $this->lStartRec + $this->lDisplayRecs - 1;
			}
		}
		if ($bSelectLimit)
			$rs = $this->LoadRecordset($this->lStartRec-1, $this->lDisplayRecs);
		if (!$rs) {
			header("Content-Type:"); // Remove header
			header("Content-Disposition:");
			$this->ShowMessage();
			return;
		}
		if ($ReporteCuotas->Export == "xml") {
			$XmlDoc = new cXMLDocument(EW_XML_ENCODING);
			$XmlDoc->AddRoot();
		} else {
			$ExportDoc = new cExportDocument($ReporteCuotas, "h");
			$ExportDoc->ExportHeader();
			if ($ExportDoc->Horizontal) { // Horizontal format, write header
				$ExportDoc->BeginExportRow();
				$ExportDoc->ExportCaption($ReporteCuotas->Creditos);
				$ExportDoc->ExportCaption($ReporteCuotas->Financiera);
				$ExportDoc->ExportCaption($ReporteCuotas->id);
				$ExportDoc->ExportCaption($ReporteCuotas->Expr1);
				$ExportDoc->ExportCaption($ReporteCuotas->Nombre);
				$ExportDoc->ExportCaption($ReporteCuotas->Apellido);
				$ExportDoc->ExportCaption($ReporteCuotas->Dni);
				$ExportDoc->ExportCaption($ReporteCuotas->cuota);
				$ExportDoc->ExportCaption($ReporteCuotas->vencimiento);
				$ExportDoc->ExportCaption($ReporteCuotas->capital);
				$ExportDoc->ExportCaption($ReporteCuotas->intereses);
				$ExportDoc->ExportCaption($ReporteCuotas->total);
				$ExportDoc->ExportCaption($ReporteCuotas->saldo);
				$ExportDoc->ExportCaption($ReporteCuotas->punitorios);
				$ExportDoc->ExportCaption($ReporteCuotas->estado);
				$ExportDoc->EndExportRow();
			}
		}

		// Move to first record
		$this->lRecCnt = $this->lStartRec - 1;
		if (!$rs->EOF) {
			$rs->MoveFirst();
			if (!$bSelectLimit && $this->lStartRec > 1)
				$rs->Move($this->lStartRec - 1);
		}
		while (!$rs->EOF && $this->lRecCnt < $this->lStopRec) {
			$this->lRecCnt++;
			if (intval($this->lRecCnt) >= intval($this->lStartRec)) {
				$this->LoadRowValues($rs);

				// Render row
				$ReporteCuotas->CssClass = "";
				$ReporteCuotas->CssStyle = "";
				$ReporteCuotas->RowType = EW_ROWTYPE_VIEW; // Render view
				$this->RenderRow();
				if ($ReporteCuotas->Export == "xml") {
					$XmlDoc->AddRow();
					$XmlDoc->AddField('Creditos', $ReporteCuotas->Creditos->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('Financiera', $ReporteCuotas->Financiera->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('id', $ReporteCuotas->id->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('Expr1', $ReporteCuotas->Expr1->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('Nombre', $ReporteCuotas->Nombre->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('Apellido', $ReporteCuotas->Apellido->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('Dni', $ReporteCuotas->Dni->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('cuota', $ReporteCuotas->cuota->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('vencimiento', $ReporteCuotas->vencimiento->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('capital', $ReporteCuotas->capital->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('intereses', $ReporteCuotas->intereses->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('total', $ReporteCuotas->total->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('saldo', $ReporteCuotas->saldo->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('punitorios', $ReporteCuotas->punitorios->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
					$XmlDoc->AddField('estado', $ReporteCuotas->estado->ExportValue($ReporteCuotas->Export, $ReporteCuotas->ExportOriginalValue));
				} else {
					$ExportDoc->BeginExportRow(TRUE); // Allow CSS styles if enabled
					$ExportDoc->ExportField($ReporteCuotas->Creditos);
					$ExportDoc->ExportField($ReporteCuotas->Financiera);
					$ExportDoc->ExportField($ReporteCuotas->id);
					$ExportDoc->ExportField($ReporteCuotas->Expr1);
					$ExportDoc->ExportField($ReporteCuotas->Nombre);
					$ExportDoc->ExportField($ReporteCuotas->Apellido);
					$ExportDoc->ExportField($ReporteCuotas->Dni);
					$ExportDoc->ExportField($ReporteCuotas->cuota);
					$ExportDoc->ExportField($ReporteCuotas->vencimiento);
					$ExportDoc->ExportField($ReporteCuotas->capital);
					$ExportDoc->ExportField($ReporteCuotas->intereses);
					$ExportDoc->ExportField($ReporteCuotas->total);
					$ExportDoc->ExportField($ReporteCuotas->saldo);
					$ExportDoc->ExportField($ReporteCuotas->punitorios);
					$ExportDoc->ExportField($ReporteCuotas->estado);
					$ExportDoc->EndExportRow();
				}
			}
			$rs->MoveNext();
		}
		if ($ReporteCuotas->Export <> "xml")
			$ExportDoc->ExportFooter();

		// Close recordset
		$rs->Close();

		// Clean output buffer
		if (!EW_DEBUG_ENABLED && ob_get_length())
			ob_end_clean();

		// Write BOM if utf-8
		if ($utf8 && !in_array($ReporteCuotas->Export, array("email", "xml")))
			echo "\xEF\xBB\xBF";

		// Write debug message if enabled
		if (EW_DEBUG_ENABLED)
			echo ew_DebugMsg();

		// Output data
		if ($ReporteCuotas->Export == "xml") {
			header("Content-Type: text/xml");
			echo $XmlDoc->XML();
		} elseif ($ReporteCuotas->Export == "email") {
			$this->ExportEmail($ExportDoc->Text);
			$this->Page_Terminate($ReporteCuotas->ExportReturnUrl());
		} else {
			echo $ExportDoc->Text;
		}
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	function Message_Showing(&$msg) {

		// Example:
		//$msg = "your new message";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}

	// ListOptions Load event
	function ListOptions_Load() {

		// Example: 
		//$this->ListOptions->Add("new");
		//$this->ListOptions->Items["new"]->OnLeft = TRUE; // Link on left
		//$this->ListOptions->MoveItem("new", 0); // Move to first column

	}

	// ListOptions Rendered event
	function ListOptions_Rendered() {

		// Example: 
		//$this->ListOptions->Items["new"]->Body = "xxx";

	}
}
?>
